﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model.Dtos
{
    public class ReturnResult
    {
        public bool State { get; set; } = true;
        public int Code { get; set; } = (int)ResultCode.Success;

        public string Message { get; set; } = "操作成功";

        public object Data { get; set; }

        public void Fail(string message)
        {
            State = false;    
            Code = (int)ResultCode.Fail;
            Message = message;
        }

        public void Error(string message, object data)
        {
            State = false;
            Code = (int)ResultCode.Error;
            Message = message;
            Data = data;
        }

    }

    public enum ResultCode
    {
        Fail = 0,
        Success = 1,
        ConfirmIsContinue = 2,
        Error = 3
    }
}
